﻿using System;
using System.Collections.Generic;

using Microsoft.Xna.Framework;

namespace AlfarEngine.Components
{
    public class Camera : AComponent
    {
        #region Variables

        static public Camera mainCamera = null;

        private float mZoom;
        private float mInvZoom;

        #endregion

        //-------------------------------------------

        #region Accessors

        public float zoom { get { return mZoom; } set { mZoom = value; mInvZoom = 1.0f / mZoom; } }
        public float invZoom { get { return mInvZoom; } }
        public Vector2 upperCorner { get { return owner.position - Engine.resolution / 2.0f;} }

        #endregion

        //----------------------------------------------

        #region Methods

        public Camera(GameObject pOwner)
            : base(pOwner)
        {
            zoom = 1;

            if(mainCamera == null)
                mainCamera = this;
        }

        #endregion
    }
}
